#include"mystdio.h"
#include<string.h>
#include<unistd.h>
int main()
{
    MyFile *filep = MyFopen("log.txt", "a");
    if(filep == NULL) 
    {
        perror("myopen fail\n");
        return 1;
    }
    int cnt = 5;
    while(cnt--)
    {
        const char* msg = "hello mystido";
        MyFwrite(msg, strlen(msg), filep);
        printf("%s\n", filep->outbuffer);
        MyFflush(filep);
        sleep(1);
    }
    MyFclose(filep);
    return 0;
}
//int main()
//{
//    MyFile *filep = MyFopen("log.txt", "a");
//    if(filep == NULL) 
//    {
//        perror("myopen fail\n");
//        return 1;
//    }
//    const char* msg = "hello mystido\n";
//    MyFwrite(msg, strlen(msg), filep);
//    MyFclose(filep);
//    return 0;
//}

//先测一个简单的写
//之后去掉字符串的\n，观察不按照行刷新的log.txt的库缓冲区和文件内核缓冲区；加深理解刷新
//之后使用MyFflush强制刷新再观察结果
